package com.qifan.energy.adapter;

import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.qifan.energy.R;
import com.qifan.energy.global.GlideApp;

import java.util.List;

public class DetailImageAdapter extends BaseQuickAdapter<String,BaseViewHolder> {

    public DetailImageAdapter(@Nullable List<String> data) {
        super(R.layout.detail_image_item, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, String item) {
        ImageView imageView = helper.getView(R.id.image);
        GlideApp.with(helper.itemView)
                .load(item)
                .placeholder(R.mipmap.icon_default_rect)
                .error(R.mipmap.icon_default_rect)
                .diskCacheStrategy(DiskCacheStrategy.ALL)
                .into(imageView);
    }
}
